﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WanMeiCommon;
using WanMeiModel;

namespace WanMeiService
{
    public class MainHub : BaseHub
    {
        /// <summary>
        /// 建立客户端连接
        /// </summary>
        /// <param name="un"></param>
        /// <param name="heroId"></param>
        public void CreateConnected(string un, int heroId)
        {
            UserInfoModel result = new UserInfoModel(un, 1, Context.ConnectionId,heroId);
            bool isSuccess = false;
            try
            {
                PublicDataInfomation.Instance.AddUser(result);
                isSuccess = true;
            }
            catch (Exception ex)
            {
                LogManger.Instance.WriteLog(ex.ToString(), "MainHub");
            }
            base.ConnectedReceive<UserInfoModel>(isSuccess, result);
        }
    }
}
